home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
qbprog.EXE
/
MODEMILK.BAS
< prev
next >
Wrap
BASIC Source File
|
1995-10-18
|
4KB
|
182 lines
'QBASIC'de çalìƒìr
' bu dilde bellek sorunu nedeniyle yavaƒ bir hìz seçiniz.
'QuickBasic de çalìƒmasì için ise versiyon 7.1 QBX /L QBX /C:32000
' versiyon 4.5 QB /L QB /C:32000
' ƒeklinde yüklenmelidir.
'Her türlü modemde çalìƒan iletiƒim programì Çekirdek mödülü
'Deºiƒkenler (**** sadece burayì deºiƒtiriniz ****)
'Kendi modeminize ait deºerleri deºiƒkenlere atayìnìz
Irq = 5
Port = &H3E8
Baud = 14400
Ansi = 1 'Ansi.sys yüklü deºilse Ansi=0 olmalì (ekran için)
'Program Baƒlangìcì
COLOR 7, 1
CLS
GOSUB DegerleriSakla
GOSUB EkranAc
GOSUB ModemiAc
GOSUB IRQ3PasifOlsun
GOSUB BaudAyarla
GOSUB IrqAdresiniAyarla
GOSUB IrqAktifOlsun
GOSUB Basla
GOSUB ModemiKapa
GOSUB DegerleriYerineKoy
END
DegerleriSakla:
DIM Sakla(27)
DEF SEG = 0
FOR I = 40 TO 63: 'ÿnterrupt adresleri
Sakla(I - 40) = PEEK(I)
NEXT
Sakla(24) = INP(&H21) 'PIC deºerleri
Sakla(25) = INP(&HA1)
Sakla(26) = PEEK(1026) 'Com2 adresi
Sakla(27) = PEEK(1027)
POKE 1027, FIX(Port / 256)
POKE 1026, Port - PEEK(1027) * 256
RETURN
DegerleriYerineKoy:
DEF SEG = 0
FOR I = 40 TO 63: 'ÿnterrupt adresleri
POKE I, Sakla(I - 40)
NEXT
OUT &H21, Sakla(24) 'PIC deºerleri
OUT &HA1, Sakla(25)
POKE 1026, Sakla(26) 'Com2 adresi
POKE 1027, Sakla(27)
RETURN
EkranAc:
IF Ansi = 1 THEN OPEN "CON" FOR OUTPUT AS #2 ELSE OPEN "SCRN:" FOR OUTPUT AS #2
RETURN
ModemiAc:
OPEN "Com2:2400,N,8,1" FOR RANDOM AS #1
RETURN
BaudAyarla:
Sakla = INP(Port + 3)
OUT Port + 3, 128
OUT Port, 115200 / Baud
OUT Port + 3, Sakla
RETURN
IrqAdresiniAyarla:
IntAdres = (Irq + 8) * 4
POKE IntAdres, PEEK(44)
POKE IntAdres + 1, PEEK(45)
POKE IntAdres + 2, PEEK(46)
POKE IntAdres + 3, PEEK(47)
RETURN
IrqAktifOlsun:
RESTORE IRQSerbest
REDIM Oku(44)
DEF SEG = VARSEG(Oku(0))
FOR PicMask = 0 TO 44
READ D%
IF PicMask = 13 THEN D% = Irq
POKE VARPTR(Oku(0)) + PicMask, D%
NEXT PicMask
CALL ABSOLUTE(VARPTR(Oku(0)))
RETURN
IRQ3PasifOlsun:
OUT &H21, Sakla(24) 'PIC deºerleri
OUT &HA1, Sakla(25)
RETURN
ModemiKapa:
PRINT #1, "ATH"
OUT Port + 4, (INP(Port + 4) AND 252)
CLOSE #1
RETURN
Basla:
LOCATE 1, 1, 1: PRINT "Modem ÿnstall ediliyor"
PRINT #1, "ATZ"
RR = FIX(TIMER)
DO
IF LOC(1) > 0 THEN B$ = B$ + INPUT$(LOC(1), #1)
IF INSTR(B$, "OK") > 0 THEN EXIT DO
IF FIX(TIMER) - RR > 5 THEN
PRINT "Modem Port Adresi ve IRQ deºerleri hatalì !!"
RETURN
END IF
LOOP
LOCATE 1, 1, 1: PRINT "Modem uygun bulundu, baƒladì (Çìkìƒ için Esc)"
DO
A$ = INKEY$
IF A$ <> "" THEN
IF ASC(A$) = 27 THEN EXIT DO
PRINT #1, A$; : 'Modem girdisi
ELSE
IF LOC(1) > 0 THEN
B$ = INPUT$(LOC(1), #1)
PRINT #2, B$; : 'Modem çìktìsì
END IF
END IF
LOOP
RETURN
IRQSerbest:
DATA &H50 : 'PUSH AX
DATA &H53 : 'PUSH BX
DATA &H51 : 'PUSH CX
DATA &H1E : 'PUSH DS
DATA &HFA : 'CLI
DATA &HB8, 0, &HB9 : 'MOV AX,B900
DATA &H8E, &HD8 : 'MOV DS,AX
DATA &H31, &HC9 : 'XOR CX,CX
DATA &HB1, 2 : 'MOV CL,02
DATA &HBB, 1, 0 : 'MOV BX,0001
DATA &HD3, &HE3 : 'SHL BX,CL
DATA &HF7, &HD3 : 'NOT BX
DATA &HE4, &HA1 : 'IN AL,A1
DATA &HA2, 0, 0 : 'MOV [0000],AL
DATA &H20, &HF8 : 'AND AL,BH
DATA &HE6, &HA1 : 'OUT A1,AL
DATA &HE4, &H21 : 'IN AL,21
DATA &HA2, 1, 0 : 'MOV [0001],AL
DATA &H20, &HD8 : 'AND AL,BL
DATA &HE6, &H21 : 'OUT 21,AL
DATA &HFB : 'STI
DATA &H1F : 'POP DS
DATA &H59 : 'POP CX
DATA &H5B : 'POP BX
DATA &H58 : 'POP AX
DATA &HCB : 'RETF